package net.huashitong.synthetical.showView.service;

import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import static net.huashitong.synthetical.showView.util.HttpsUtils.doGet;
import static net.huashitong.synthetical.showView.util.URLstatic.GET_ZD_DATA_COUNT;
import static net.huashitong.synthetical.showView.util.URLstatic.GET_ZS_DATA_COUNT;

@Service
public class IndexService {

    Logger log = LoggerFactory.getLogger(IndexService.class);

    //重大节点项目数据
    public int queryZhongDaDataCount() {
        String code = "500";
        //获取重大项目总的节点数
        String url = GET_ZD_DATA_COUNT;
        int count = 0;
        JSONObject jsonObject1;
        try {
            jsonObject1 = doGet(url, null);
            code = jsonObject1.getString("code");
        } catch (Exception e) {
            return count;
        }
        //获取成功
        if ("200".equals(code)) {
            count = jsonObject1.getInteger("data");
        }
        return count;
    }

    //招商项目数据
//    public int queryZhaoShangDataCount(){
//        String code = "500";
//        //获取重大项目总的节点数
//        String url = GET_ZS_DATA_COUNT;
//        int count = 0;
//        JSONObject jsonObject1;
//        try {
//            jsonObject1 = doGet(url, null);
//            code = jsonObject1.getString("code");
//        } catch (Exception e) {
//            return count;
//        }
//        //获取成功
//        if ("200".equals(code)) {
//            count = jsonObject1.getInteger("data");
//        }
//        return count;
//    }
}
